Importing the libraries is one of the key thing we need to do, let's do it starting with some basic library requirements
from sklearn.datasets import load_files
from keras.utils import np_utils
import numpy as np
import pandas as pd
from glob import glob
import random
import cv2
import matplotlib.pyplot as plt
%matplotlib inline
from keras.applications.resnet50 import ResNet50
from keras.preprocessing import image
from tqdm import tqdm
from keras.applications.resnet50 import preprocess_input, decode_predictions
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
import os
Lets, Now load the labels to see the count of training and testing labels. Training labels are provided in the csv file and a sample of submission file is provided as a csv, lets load them and drop if NA(Empty) values exist and see the count
train_labels = pd.read_csv("/invasive-species/train_labels.csv")
sample_submission = pd.read_csv("/invasive-species/sample_submission.csv")
train_labels.dropna
train_labels.tail()
sample_submission.dropna
sample_submission.tail()
print('There are %d total training images.' % len(train_labels))
print('There are %d total testing images.' % len(sample_submission))
Lets look at a few image visuals
import matplotlib.image as mpatImg
def species_images(img_path):
imgPrnt = mpatImg.imread(img_path)
plt.figure(figsize=(10,10))
plt.imshow(imgPrnt)
Lets look at some random Training images to check there is no exceptions
species_images('/invasive-species/train/1.jpg')
species_images('/invasive-species/train/29.jpg')
species_images('/invasive-species/train/298.jpg')
species_images('/invasive-species/train/1008.jpg')
species_images('/invasive-species/train/1007.jpg')
species_images('/invasive-species/train/2287.jpg')
Lets now look at some random set of testing set images
species_images('/invasive-species/test/76.jpg')
species_images('/invasive-species/test/987.jpg')
species_images('/invasive-species/test/585.jpg')
species_images('/invasive-species/test/1212.jpg')
species_images('/invasive-species/test/1007.jpg')
species_images('/invasive-species/test/1431.jpg')